﻿

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>沙驰经销商在线交易平台</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="../layuiadmin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="../layuiadmin/style/admin.css" media="all">
  
  <!--<script>
  /^http(s*):\/\//.test(location.href) || alert('请先部署到 localhost 下再访问');
  </script>-->
</head>
<body class="layui-layout-body">

    <div id="LAY_app">
        <div class="layui-layout layui-layout-admin">
            <div class="layui-header">
                <!-- 头部区域 -->
                <ul class="layui-nav layui-layout-left">
                    <li class="layui-nav-item layadmin-flexible" lay-unselect>
                        <a href="javascript:;" layadmin-event="flexible" title="侧边伸缩">
                            <i class="layui-icon layui-icon-shrink-right" id="LAY_app_flexible"></i>
                        </a>
                    </li>
                    <li class="layui-nav-item layui-hide-xs" lay-unselect>
                        <a href="http://www.layui.com/" target="_blank" title="前台">
                            <i class="layui-icon layui-icon-website"></i>
                        </a>
                    </li>
                    <li class="layui-nav-item" lay-unselect>
                        <a href="javascript:;" layadmin-event="refresh" title="刷新">
                            <i class="layui-icon layui-icon-refresh-3"></i>
                        </a>
                    </li>
                    <li class="layui-nav-item layui-hide-xs" lay-unselect>
                        <input type="text" placeholder="搜索..." autocomplete="off" class="layui-input layui-input-search" layadmin-event="serach" lay-action="template/search.html?keywords=">
                    </li>
                </ul>
                <ul class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right">

                    <li class="layui-nav-item" lay-unselect>
                        <a lay-href="app/message/index.html" layadmin-event="message" lay-text="消息中心">
                            <i class="layui-icon layui-icon-notice"></i>

                            <!-- 如果有新消息，则显示小圆点 -->
                            <span class="layui-badge-dot"></span>
                        </a>
                    </li>
                    <li class="layui-nav-item layui-hide-xs" lay-unselect>
                        <a href="javascript:;" layadmin-event="theme">
                            <i class="layui-icon layui-icon-theme"></i>
                        </a>
                    </li>
                    <li class="layui-nav-item layui-hide-xs" lay-unselect>
                        <a href="javascript:;" layadmin-event="note">
                            <i class="layui-icon layui-icon-note"></i>
                        </a>
                    </li>
                    <li class="layui-nav-item layui-hide-xs" lay-unselect>
                        <a href="javascript:;" layadmin-event="fullscreen">
                            <i class="layui-icon layui-icon-screen-full"></i>
                        </a>
                    </li>
                    <li class="layui-nav-item" lay-unselect>
                        <a href="javascript:;">
                            <cite id="c_username"></cite>
                        </a>
                        <dl class="layui-nav-child">
                            <dd><a lay-href="set/user/info.html">基本资料</a></dd>
                            <dd><a lay-href="set/user/password.html">修改密码</a></dd>
                            <hr>
                            <dd  style="text-align: center;"><a onclick="goout()">退出</a></dd>
                            <!--<dd layadmin-event="logout" style="text-align: center;"><a onclick="goout()">退出</a></dd>-->
                        </dl>
                    </li>

                    <li class="layui-nav-item layui-hide-xs" lay-unselect>
                        <a href="javascript:;" layadmin-event="about"><i class="layui-icon layui-icon-more-vertical"></i></a>
                    </li>
                    <li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-unselect>
                        <a href="javascript:;" layadmin-event="more"><i class="layui-icon layui-icon-more-vertical"></i></a>
                    </li>
                </ul>
            </div>

            <!-- 侧边菜单 -->
            <div class="layui-side layui-side-menu">
                <div class="layui-side-scroll">
                    <div class="layui-logo" lay-href="home/console.html">
                        <span>沙驰经销商在线交易平台</span>
                    </div>

                    <!--<ul class="layui-nav layui-nav-tree"  lay-shrink="all" id="LAY-system-side-menu" lay-filter="layadmin-system-side-menu">-->
                    <ul class="layui-nav layui-nav-tree" lay-shrink="all" id="left_nav" lay-filter="layadmin-system-side-menu">
                        <!--<li data-name="home" class="layui-nav-item layui-nav-itemed">
            <a lay-href="home/console.html" lay-tips="主页" class="layui-this" lay-direction="2">
                <i class="layui-icon layui-icon-home"></i>
                <cite>主页</cite>
            </a>
        </li>
        <li data-name="home" class="layui-nav-item layui-nav-itemed">
            <a href="javascript:;" lay-tips="订单管理" lay-direction="2">
                <i class="layui-icon layui-icon-list"></i>
                <cite>订单管理</cite>
            </a>
            <dl class="layui-nav-child">
                <dd data-name="console">
                    <a lay-href="order/list.html">订单管理</a>
                </dd>
            </dl>
            <dl class="layui-nav-child">
                <dd data-name="console">
                    <a lay-href="orderProgress/index.html">订单进度查询</a>
                </dd>
            </dl>
        </li>
        <li data-name="user" class="layui-nav-item">
            <a href="javascript:;" lay-tips="系统管理" lay-direction="2">
                <i class="layui-icon layui-icon-user"></i>
                <cite>系统管理</cite>
            </a>
            <dl class="layui-nav-child">
                <dd>
                    <a lay-href="system/user/list.html">用户管理</a>
                </dd>
                <dd class="layui-nav-itemed">
                    <a href="javascript:;">权限管理</a>
                    <dl class="layui-nav-child">
                        <dd>
                            <a lay-href="system/menu/list.html">菜单管理</a>
                        </dd>
                        <dd>
                            <a lay-href="system/funcitonsystem/list.html">功能管理</a>
                        </dd>
                        <dd>
                            <a lay-href="system/roles/list.html">角色管理</a>
                        </dd>
                    </dl>
                </dd>
            </dl>
        </li>
        <li data-name="set" class="layui-nav-item">
            <a href="javascript:;" lay-tips="设置" lay-direction="2">
                <i class="layui-icon layui-icon-set"></i>
                <cite>设置</cite>
            </a>
            <dl class="layui-nav-child">
                <dd class="layui-nav-itemed">
                    <a href="javascript:;">类型设置</a>
                    <dl class="layui-nav-child">
                        <dd><a lay-href="set/lxpicmanager/list.html">图标管理</a></dd>
                        <dd><a lay-href="set/typemanager/list.html">类型管理</a></dd>
                        <dd><a lay-href="set/SpecialBodyManager/list.html">特体管理</a></dd>
                        <dd><a lay-href="set/bwManager/list.html">部位管理</a></dd>
                        <dd><a lay-href="set/cmManager/list.html">部位尺码管理</a></dd>
                    </dl>
                </dd>
                <dd class="layui-nav-itemed">
                    <a href="javascript:;">我的设置</a>
                    <dl class="layui-nav-child">
                        <dd><a lay-href="set/user/info.html">基本资料</a></dd>
                        <dd><a lay-href="set/user/password.html">修改密码</a></dd>
                    </dl>
                </dd>
            </dl>
        </li>
        <li data-name="get" class="layui-nav-item">
            <a href="javascript:;" layadmin-event="about" lay-tips="授权" lay-direction="2">
                <i class="layui-icon layui-icon-auz"></i>
                <cite>关于</cite>
            </a>
        </li>-->
                    </ul>
                </div>
            </div>
            <!-- 页面标签 -->
            <div class="layadmin-pagetabs" id="LAY_app_tabs">
                <div class="layui-icon layadmin-tabs-control layui-icon-prev" layadmin-event="leftPage"></div>
                <div class="layui-icon layadmin-tabs-control layui-icon-next" layadmin-event="rightPage"></div>
                <div class="layui-icon layadmin-tabs-control layui-icon-down">
                    <ul class="layui-nav layadmin-tabs-select" lay-filter="layadmin-pagetabs-nav">
                        <li class="layui-nav-item" lay-unselect>
                            <a href="javascript:;"></a>
                            <dl class="layui-nav-child layui-anim-fadein">
                                <dd layadmin-event="closeThisTabs"><a href="javascript:;">关闭当前标签页</a></dd>
                                <dd layadmin-event="closeOtherTabs"><a href="javascript:;">关闭其它标签页</a></dd>
                                <dd layadmin-event="closeAllTabs"><a href="javascript:;">关闭全部标签页</a></dd>
                            </dl>
                        </li>
                    </ul>
                </div>
                <div class="layui-tab" lay-unauto lay-allowClose="true" lay-filter="layadmin-layout-tabs">
                    <ul class="layui-tab-title" id="LAY_app_tabsheader">
                        <li lay-id="home/console.html" lay-attr="home/console.html" class="layui-this"><i class="layui-icon layui-icon-home"></i></li>
                    </ul>
                </div>
            </div>
            <!-- 主体内容 -->
            <div class="layui-body" id="LAY_app_body">
                <div class="layadmin-tabsbody-item layui-show">
                    <iframe src="home/console.html" frameborder="0" class="layadmin-iframe"></iframe>
                </div>
            </div>
            <!-- 辅助元素，一般用于移动设备下遮罩 -->
            <div class="layadmin-body-shade" layadmin-event="shade"></div>
        </div>
    </div>
    <script src="../layuiadmin/js/jquery.min2.1.4.js"></script>
    <script src="../layuiadmin/layui/layui.js"></script>
    <script src="../layuiadmin/js/jshelp.js"></script>
    <script src="../layuiadmin/js/cookie.js"></script>

    <script>
        function goout() {
            $.removeCookie("id", { path: "/", sucue: true });//用户id
            $.removeCookie("loginid", { path: "/", sucue: true });//登录账号
            $.removeCookie("username", { path: "/", sucue: true });//用户名
            $.removeCookie("role", { path: "/", sucue: true });//权限
            $.removeCookie("islookme", { path: "/", sucue: true });//权限
            window.location.href = "../login.html";
        }

        layui.config({
            base: '../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'user', 'layer'], function () {
            var $ = layui.$,
                form = layui.form,
                layer = layui.layer;
            if ($.cookie("loginid") == "" || $.cookie("loginid") == null || $.cookie("loginid") == "null" || $.cookie("loginid") == undefined || $.cookie("loginid") == "undefined") {           
                $.removeCookie("id", { path: "/", sucue: true });//用户id
                $.removeCookie("loginid", { path: "/", sucue: true });//登录账号
                $.removeCookie("username", { path: "/", sucue: true });//用户名
                $.removeCookie("role", { path: "/", sucue: true });//权限
                $.removeCookie("islookme", { path: "/", sucue: true });//权限
                window.location.href = "../login.html";
            }
            else {
                $("#c_username").text($.cookie("username"));
                $.ajax({
                    type: "get",
                    async: false, //请求均为同步请求，在没有返回值之前，同步请求将锁住浏览器，用户其它操作必须等待请求完成才可以执行
                    url: "../ashx/menu.ashx?type=getmenuinfo&loginidss=" + $.cookie("loginid"),
                    dataType: "json",
                    success: function (data) {
                        //加载全部菜单列表
                        var menudata = data.data;
                        if (menudata.length > 0) {
                            loadnav(menudata);
                        }
                    },
                    error: function (data) {
                        layer.error(data);
                    }
                });

            }
            function loadnav(navdata) {
                for (var i = 0; i < navdata.length; i++) {
                            var first_menu = navdata[i];
                             var childMenus = first_menu.list;
                             //console.log("子菜单=="+JSON.stringify(childMenus));
                             if (childMenus == null || childMenus == undefined || childMenus == "") {
                                     //console.log("没有子菜单=="+first_menu.name);
                                     loadTopMenu(first_menu);
                             } else {
                                      //console.log("有子菜单=="+first_menu.name);
                                    loadHasChildMenu(first_menu);
                              }
                    }
                   //列表添加完后再次执行渲染
                   xuanran();
            }
            function FrameWH() {
                var h = $(window).height() - 164;
                //console.log("高度问题=="+h);
                $("iframe").css("height", h + "px");
            }
            //加载带有子菜单的
            function loadHasChildMenu(data) {
                    var fragment = document.getElementById("left_nav");
                    var list = document.createElement('li');
                    //list.className = "layui-nav-item layui-nav-itemed";//菜单默认展开
                list.className = "layui-nav-item";//菜单默认收起
                    var child_one_Html = '<a href="javascript:;">' + data.name + '</a>';
                    var childmenus = data.list;
                    var child_two_Html = '<dl class="layui-nav-child">';
                    var childHtmls = "";
                for (var i = 0; i < childmenus.length; i++) {
                        var childmenu = childmenus[i];
                        var childmenthree = childmenus[i].list;
                        var childHtml = '';
                        if (childmenthree == undefined) {
                             childHtml = '<dd><a class="site-demo-active" data-menuId=' + childmenu.menuId + ' lay-href=' + childmenu.url + ' data-title=' + childmenu.name + '>' + childmenu.name + '</a></dd>';
                        } else {
                            childHtml += '<dd class="layui-nav-itemed"><a href="javascript:;">' + childmenu.name + '</a> ';
                            childHtml += '  <dl class="layui-nav-child">';
                            for (var j = 0; j < childmenthree.length; j++) {
                                childHtml += ' <dd>  <a data-menuId=' + childmenthree[j].menuId + ' data-title=' + childmenthree[j].name + ' lay-href=' + childmenthree[j].url + ' >' + childmenthree[j].name + '</a> </dd>';
                            }
                            childHtml += '</dl>';
                            childHtml += '</dd>';
                        }
                          childHtmls += childHtml;
                    }
                    child_two_Html += childHtmls + '</dl>';
                    list.innerHTML = child_one_Html + child_two_Html;
                    fragment.appendChild(list);
                    //console.log("2.=多级菜单列表加载完毕");
            }
            //加载顶级菜单(没有子菜单)
            function loadTopMenu(data) {
                    var fragment = document.getElementById("left_nav");
                    var list = document.createElement('li');
                    list.className = "layui-nav-item";
                //aa
                list.innerHTML = '<a class="site-demo-active" data-menuId=' + data.menuId + ' lay-href=' + data.url + '>' + data.name + '</a>';
                    fragment.appendChild(list);
                    //console.log("1.=顶级菜单列表加载完毕"); 
            }
            function xuanran() {
                    layui.use(['element', 'layer'], function () {
                          var element = layui.element;
                          layer = layui.layer;

                          var layFilter = $("#left_nav").attr('lay-filter');
                          element.render('nav', layFilter);

                          var active = {
                                //在这里给active绑定几项事件，后面可通过active调用这些事件
                                tabAdd: function (url, id, name) {
                                        //新增一个Tab项 传入三个参数，分别对应其标题，tab页面的地址，还有一个规定的id，是标签中data-id的属性值
                                        //var body_url = "pages/" + url + ".html";
                                    var body_url =  url;
                                        //console.log("要切换的页面地址=" + body_url);
                                        element.tabAdd('demo', {
                                                title: name,
                                                content: '<iframe data-frameid="' + id + '" scrolling="auto" frameborder="0" src="' + body_url + '"></iframe>',
                                                id: id //规定好的id
                                        })
                                        FrameWH();  //计算ifram层的大小
                                },
                                tabChange: function (id) {
                                        //切换到指定Tab项
                                        element.tabChange('demo', id); //根据传入的id传入到指定的tab项
                                },
                                tabDelete: function (id) {
                                        element.tabDelete("demo", id);//删除
                                }
                          };
                          // //当点击有site-demo-active属性的标签时，即左侧菜单栏中内容 ，触发点击事件
                          $('.site-demo-active').on('click', function () {
                                   var dataid = $(this);
                                   if ($(".layui-tab-title li[lay-id]").length <= 0) {
                                           //如果比零小，则直接打开新的tab项
                                           //console.log("1.没有tab页，新建tab页");
                            //console.log("2.没有tab页，新建tab页==" + dataid.text() + "==" + dataid.attr("data-menuId") + "===" + dataid.attr("data-title"));
                            active.tabAdd(dataid.attr("data-src"), dataid.attr("data-menuId"), dataid.attr("data-title"));
                        } else {
                                          //否则判断该tab项是否以及存在
                                          var isData = false; //初始化一个标志，为false说明未打开该tab项 为true则说明已有
                                          $.each($(".layui-tab-title li[lay-id]"), function () {
                                                  //如果点击左侧菜单栏所传入的id 在右侧tab项中的lay-id属性可以找到，则说明该tab项已经打开
                                                  if ($(this).attr("lay-id") == dataid.attr("data-menuId")) {
                                                        //console.log("如果点击左侧菜单栏所传入的id 在右侧tab项中的lay-id属性可以找到，则说明该tab项已经打开");
                                                        isData = true;
                                               }
                                          })
                                          if (isData == false) {
                                                //标志为false 新增一个tab项
                                                //console.log("新增一个tab项")
                                                active.tabAdd(dataid.attr("data-src"), dataid.attr("data-menuId"), dataid.attr("data-title"));
                                          }
                                 }
                                //最后不管是否新增tab，最后都转到要打开的选项页面上
                                active.tabChange(dataid.attr("data-menuId"));
                          });
                    })
                    //console.log("==列表添加完后再次执行渲染");
            }
  
        });
    </script>

    <!-- 百度统计 -->
    <!--<script>
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?d214947968792b839fd669a4decaaffc";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
    </script>-->
</body>
</html>


